How to truncate a decimal without rounding

89

How to truncate a decimal without rounding -

var value = 1.23456M;
var shortenedValue = Convert.ToDecimal(value.ToString("0.###"));

Assert.Equals(shortenedValue, 1.234);
1234

Comments

Submit
0 Comments